package com.yl.immodule.fragment

import android.content.Intent
import android.util.Log
import androidx.activity.viewModels
import androidx.fragment.app.viewModels
import androidx.lifecycle.Observer
import com.alibaba.android.arouter.facade.annotation.Route
import com.camera.base.BaseApp
import com.camera.base.v.BaseFragment
import com.camera.routemodule.RouterPath
import com.yl.immodule.R
import com.yl.immodule.databinding.FragmentPttStateBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = RouterPath.path.ptt_fragment_state)
class PttStateFragment : BaseFragment<FragmentPttStateBinding>() {
    private val viewModel: IMViewModel by viewModels()
    override fun loadData(isRefresh: Boolean) {
        mBinding.viewModel = viewModel
        // 观察 booleanLiveData
        viewModel.animLiveData.observe(this, Observer { value ->
            if (value) mBinding.voice.start() else mBinding.voice.stop()
        })
        viewModel.animDataLiveData.observe(this, Observer { value ->
            mBinding.voice.setVolume(value)
        })
    }

    override fun initView() {

    }

    override fun getLayoutId(): Int {
        return R.layout.fragment_ptt_state
    }
}